package com.itheima.util;

import com.itheima.pojo.Result;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

@Slf4j
@RestControllerAdvice
public class GlobalExceptionHandler {

  @ExceptionHandler
    public Result handlerException(Exception ex){
    log.error("程序异常",ex);
    return Result.error("服务器异常,请稍后再重试");
}

}
